package org.example.shejimoshi.yuanze.yilai;

/**
 * 构造器方式进行依赖注入
 */
public class PurchaseBook1 {
    private Book1 book;

    PurchaseBook1(Book1 book) {
        this.book = book;
    }

    public void getBook() {
        book.getBook();
    }

    public static void main(String[] args) {
        PurchaseBook1 purchaseBook1 = new PurchaseBook1(new JavaBook1());
        purchaseBook1.getBook();
    }
}
